patch for https://bugs.freedesktop.org/show_bug.cgi?id=35268
affected: anything using openGL, most notably firefox and wine.
this needs to be used in combination with --disable-asm
(since the asm uses the same trickery).

--- Mesa-10.2.7.org/src/egl/main/eglcurrent.c
+++ Mesa-10.2.7/src/egl/main/eglcurrent.c
@@ -51,8 +51,8 @@
 static void (*_egl_FreeTSD)(_EGLThreadInfo *);
 
 #ifdef GLX_USE_TLS
-static __thread const _EGLThreadInfo *_egl_TLS
-   __attribute__ ((tls_model("initial-exec")));
+#include "tls-model.h"
+static __thread const _EGLThreadInfo *_egl_TLS TLS_MODEL;
 #endif
 
 static INLINE void _eglSetTSD(const _EGLThreadInfo *t)
--- Mesa-10.2.7.org/src/glx/glxclient.h
+++ Mesa-10.2.7/src/glx/glxclient.h
@@ -637,8 +637,9 @@
 
 # if defined( GLX_USE_TLS )
 
-extern __thread void *__glX_tls_Context
-   __attribute__ ((tls_model("initial-exec")));
+#include "tls-model.h"
+
+extern __thread void *__glX_tls_Context TLS_MODEL;
 
 #  define __glXGetCurrentContext() __glX_tls_Context
 
--- Mesa-10.2.7.org/src/glx/glxcurrent.c
+++ Mesa-10.2.7/src/glx/glxcurrent.c
@@ -79,6 +79,8 @@
 
 # if defined( GLX_USE_TLS )
 
+#include "tls-model.h"
+
 /**
  * Per-thread GLX context pointer.
  *
@@ -86,7 +88,7 @@
  * \b never be \c NULL.  This is important!  Because of this
  * \c __glXGetCurrentContext can be implemented as trivial macro.
  */
-__thread void *__glX_tls_Context __attribute__ ((tls_model("initial-exec")))
+__thread void *__glX_tls_Context TLS_MODEL
    = &dummyContext;
 
 _X_HIDDEN void
--- Mesa-10.2.7.org/src/mapi/glapi/glapi.h
+++ Mesa-10.2.7/src/mapi/glapi/glapi.h
@@ -85,11 +85,10 @@
 
 #if defined (GLX_USE_TLS)
 
-_GLAPI_EXPORT extern __thread struct _glapi_table * _glapi_tls_Dispatch
-    __attribute__((tls_model("initial-exec")));
+#include "tls-model.h"
 
-_GLAPI_EXPORT extern __thread void * _glapi_tls_Context
-    __attribute__((tls_model("initial-exec")));
+_GLAPI_EXPORT extern __thread struct _glapi_table * _glapi_tls_Dispatch TLS_MODEL;
+_GLAPI_EXPORT extern __thread void * _glapi_tls_Context TLS_MODEL;
 
 _GLAPI_EXPORT extern const struct _glapi_table *_glapi_Dispatch;
 _GLAPI_EXPORT extern const void *_glapi_Context;
--- Mesa-10.2.7.org/src/mapi/u_current.c
+++ Mesa-10.2.7/src/mapi/u_current.c
@@ -98,13 +98,11 @@
  */
 /*@{*/
 #if defined(GLX_USE_TLS)
-
-__thread struct mapi_table *u_current_table
-    __attribute__((tls_model("initial-exec")))
+#include "tls-model.h"
+__thread struct mapi_table *u_current_table TLS_MODEL
     = (struct mapi_table *) table_noop_array;
 
-__thread void *u_current_context
-    __attribute__((tls_model("initial-exec")));
+__thread void *u_current_context TLS_MODEL;
 
 #else
 
--- Mesa-10.2.7.org/src/mapi/u_current.h
+++ Mesa-10.2.7/src/mapi/u_current.h
@@ -30,11 +30,10 @@
 
 #ifdef GLX_USE_TLS
 
-extern __thread struct mapi_table *u_current_table
-    __attribute__((tls_model("initial-exec")));
+#include "tls-model.h"
+extern __thread struct mapi_table *u_current_table TLS_MODEL;
 
-extern __thread void *u_current_context
-    __attribute__((tls_model("initial-exec")));
+extern __thread void *u_current_context TLS_MODEL;
 
 #else /* GLX_USE_TLS */
 
--- Mesa-10.2.7.org/src/mesa/drivers/dri/common/dri_test.c
+++ Mesa-10.2.7/src/mesa/drivers/dri/common/dri_test.c
@@ -11,11 +11,10 @@
 
 #if defined(GLX_USE_TLS)
 
-PUBLIC __thread struct _glapi_table * _glapi_tls_Dispatch
-    __attribute__((tls_model("initial-exec")));
+#include "tls-model.h"
 
-PUBLIC __thread void * _glapi_tls_Context
-    __attribute__((tls_model("initial-exec")));
+PUBLIC __thread struct _glapi_table * _glapi_tls_Dispatch TLS_MODEL;
+PUBLIC __thread void * _glapi_tls_Context TLS_MODEL;
 
 PUBLIC const struct _glapi_table *_glapi_Dispatch;
 PUBLIC const void *_glapi_Context;
--- /dev/null
+++ Mesa-10.2.7/include/c11/tls-model.h
@@ -0,0 +1,11 @@
+#ifndef TLS_MODEL_H
+#define TLS_MODEL_H
+
+#ifdef __GLIBC__
+#define TLS_MODEL __attribute__ ((tls_model("initial-exec")))
+#else
+#define TLS_MODEL
+#endif
+
+#endif
+
